<?php

//set plugin id as file name of plugin
$plugin_id = basename(__FILE__);

//some plugin data
$data['name']   = "Testing Plugin";
$data['desc']   = "Testing plugin to test pluginFunctions";
$data['author'] = "Prit";
$data['url']    = "http://hardkap.net";

//register plugin to SHP
register_plugin($plugin_id, $data);

function testing_function1() {
  global $theme_main, $optionValue, $scriptName;
  switch ($optionValue) {
    case "submit":
        $theme_main['content']  = "Id1: ".$_POST["id1"]."<br>";
        $theme_main['content'] .= "Id2: ".$_POST["id2"]."<br>";
        break;
    default:
        $theme_main['content']  = "<h3>Testing Page</h3>";
        $theme_main['content'] .= '<form method="post" action="'.$scriptName.'/pluginFunction1/submit">';
        $theme_main['content'] .= '<p><label for="id1">Id1:</label>&nbsp;&nbsp;<input id="id1" name="id1" type="text"></p>';
        $theme_main['content'] .= '<p><label for="id2">Id2:</label>&nbsp;&nbsp;:<input id="id2" name="id2" type="text"></p>';
        $theme_main['content'] .= '<p><input type="submit" value="Submit"></p>';
        $theme_main['content'] .= '</form>';
        break;
  }
}

function testing_function2() {
  global $theme_main, $scriptName;
  $theme_main['loc_menu_bottom'] .= '<a href="'.$scriptName.'/pluginFunction1">Function1</a>';
}

//add hook, where to execute a function
add_hook($plugin_id, 'hook-pluginFunction1','testing_function1');
add_hook($plugin_id, 'hook-main','testing_function2');


?>